<?php 
	include_once("header.php");
	include_once("top_menu.php");
	if (isset($_SESSION['username'])) {
?>
	<div class = "instr_panel">

		<div class = 'header-adding'>
			Adding new device
		</div>
		<div class = 'adding'>
			<!-- Form for adding new device on map -->
			<form action = "savedeviceonmap.php" method = "POST">
				<input type = "text" size = '65' name = "place" id = "place" class = 'bordered_input' placeholder = 'Enter address here or rightclick on the map'/>
				</br>
				<textarea cols = '50' name = "info" placeholder = "Enter info here" class = 'bordered_input text_area'></textarea>
				</br>
				Device Type: 
				<select name = "type_id" style = "width: 130px;">
					<?php
						$connection = mysql_pconnect("localhost" , "root" , "31122001");
				    	mysql_select_db("kt_site");
				    	$query = "SELECT * FROM device_type;";    	
						$sql = mysql_query($query);
						for ($i = 0 ; $i < mysql_num_rows($sql) ; $i++) {
							$device = mysql_fetch_array($sql);
							echo "<option value = ".$device['id'].">".$device['name']."</option>";
						}
					?>
				</select>
				<input type = "submit" value = "Add" class = "button button-add-main"/>
			</form>
		</div>
		<!-- Choosing layers to view -->
		<div class = 'header-layer'>
			Layers
		</div>
		<div class = 'layering'>
			<?php
				$connection = mysql_pconnect("localhost" , "root" , "31122001");
	    		mysql_select_db("kt_site");
	    		$query = "SELECT * FROM users;";
				$sql = mysql_query($query);
			?>
			<input type = "checkbox" id = "layer1" value = "Physical" checked = "true" onclick = "load();"> Physical <br>
			<input type = "checkbox" id = "layer2" value = "Primary" checked = "true" onclick = "load();"> Primary <br>
		</div>
	</div>
<?php
	}
?>